package com.wawayaya.bookreader.worddict;

import android.content.Context;
import android.graphics.Typeface;
import android.text.TextPaint;
import android.util.AttributeSet;
import com.wawayaya.bookreader.jni.Pinyin;

public class ViewWordDictPinyin extends ViewWordDictText {

	private Typeface m_tfpintyin = null;
	
	public ViewWordDictPinyin(Context context) {
		super(context);
		init(context);
	}
	public ViewWordDictPinyin(Context context, AttributeSet attrs) {
		super(context, attrs);
		init(context);
	}
	public ViewWordDictPinyin(Context context, AttributeSet attrs, int defStyle) {
		super(context, attrs, defStyle);
		init(context);
	}
	
	private void init(Context ct)  {
		m_tfpintyin = Typeface.createFromAsset(ct.getAssets(), "HANSPHON.ttf");
	}
	
	public void setindicatedtext(String stext, boolean bsettext) {
		TextPaint p = getPaint();
		if(null != m_tfpintyin) {
			p.setTypeface(m_tfpintyin);
		}
		stext = Pinyin.convertpinyin(stext);
		super.calculatetextsize(p, stext);
		if(bsettext) {
			setText(stext);
		}
	}
	
	
}
